home *** CD-ROM | disk | FTP | other *** search
- global gHistory, gBaseURL, gReadyToGo
-
- on WaitForTicks theTicks
- set startTime to the timer
- repeat while (startTime + theTicks) > the timer
- nothing()
- end repeat
- end
-
- on goPage thePage, target
- global gReadyToGo
- recordHistory(thePage)
- if not (thePage contains "/") then
- set thePage to "../" & thePage
- end if
- if gReadyToGo = 1 then
- GoToNetPage(thePage, "csTopicInfo")
- fadeAllSounds(200)
- end if
- end
-
- on getCurrLabel
- set lastLine to the number of lines in the labelList - 1
- repeat with i = 1 to lastLine
- if the frame < label(line i of the labelList) then
- if i > 1 then
- return line i - 1 of the labelList
- else
- return EMPTY
- end if
- exit
- end if
- end repeat
- return line lastLine of the labelList
- end
-
- on fadeAllSounds fadeDuration
- if soundBusy(1) or soundBusy(2) then
- set lPlaying to 1
- end if
- if soundBusy(1) then
- sound fadeOut 1, fadeDuration
- end if
- if soundBusy(2) then
- sound fadeOut 2, fadeDuration
- end if
- if lPlaying then
- WaitForTicks(fadeDuration)
- end if
- end
-
- on recordHistory theURL
- if not gHistory then
- set gHistory to []
- end if
- set index to getPos(gHistory, theURL)
- if index then
- deleteAt(gHistory, index)
- end if
- append(gHistory, theURL)
- end
-
- on allSprites pup, vis, start, stop
- if not start then
- set start to 1
- end if
- if not stop then
- set stop to 48
- end if
- repeat with i = start to stop
- if not (pup = -1) then
- puppetSprite(i, pup)
- end if
- if not (vis = -1) then
- set the visible of sprite i to vis
- end if
- end repeat
- end
-
- on distance point1, point2
- set xDiff to the locH of point2 - the locH of point1
- set yDiff to the locV of point2 - the locV of point1
- set dist to sqrt(power(xDiff, 2) + power(yDiff, 2))
- return dist
- end
-
- on makeTriangle radLength, radLoc, twoPoint
- set thirdPoint to point(the locH of radLoc, the locV of radLoc - radLength)
- set thirdSide to distance(thirdPoint, twoPoint)
- return thirdSide
- end
-
- on pythagoras radLen, sideLen
- set rvSquare to power(radLen, 2) - power(sideLen, 2)
- return integer(sqrt(rvSquare))
- end
-
- on radians degrees
- set rVal to degrees * (PI / 180)
- return rVal
- end
-
- on degrees radians
- set rVal to radians * 180 / PI
- return rVal
- end
-
- on spriteCenter theSprite
- set rVal to the right of sprite theSprite - integer(the width of sprite theSprite / 2)
- return rVal
- end
-
- on getFollowAngle theSprite, rxPoint
- global oldMousePoint, oldAngle, oldSprite
- set mousePoint to point(the mouseH, the mouseV)
- if mousePoint <> getaProp(oldMousePoint, theSprite) then
- if not rxPoint then
- set rxPoint to spriteCenter(theSprite)
- end if
- if the mouseH > rxPoint then
- set mult to 1
- else
- set mult to -1
- end if
- set radLength to distance(the loc of sprite theSprite, mousePoint)
- set thirdSide to makeTriangle(radLength, the loc of sprite theSprite, mousePoint) / 2
- set chordLen to pythagoras(radLength, thirdSide)
- setaProp(oldMousePoint, theSprite, mousePoint)
- if chordLen <> 0 then
- set rVal to atan(thirdSide / chordLen) * (360 / PI)
- if not integer(rVal) then
- if string(rVal) contains "-" then
- set rVal to 180
- end if
- else
- set rVal to rVal * mult
- end if
- else
- set rVal to 180
- end if
- setaProp(oldAngle, theSprite, rVal)
- else
- set rVal to getaProp(oldAngle, theSprite)
- end if
- return rVal
- end
-